import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { TagService } from "../../../../service/tag.service";
import { Http } from "@angular/http";
import { Tag } from "../../../../entity/tag.model";

@Component({
  selector: 'app-matrix-tag-selector',
  templateUrl: './matrix-tag-selector.component.html',
  styleUrls: ['./matrix-tag-selector.component.css']
})
export class MatrixTagSelectorComponent implements OnInit {
  /**
   * 
   * 
   * @type {Tag[]}
   * @memberof MatrixTagSelectorComponent
   */
  @Input() matrixTags: Tag[];

  /**
   * 
   * 
   * @type {Tag}
   * @memberof MatrixTagSelectorComponent
   */
  @Input() selectedTag: Tag;

  /**
  * 选中项发生改变
  * 
  * 
  * @memberof FarmSelectorComponent
  */
  @Output() selectedChange: EventEmitter<Tag> = new EventEmitter<Tag>();

  constructor() {

  }
  ngOnInit() {

  }

  /**
   * 
   * 
   * @param {Tag} tag 
   * @memberof MatrixTagSelectorComponent
   */
  onClick(tag: Tag) {
    if (this.selectedTag !== tag) {
      this.selectedTag = tag;
      this.selectedChange.emit(this.selectedTag);
    }
  }

}



// WEBPACK FOOTER //
// ./src/app/module/monitor/turbine-matrix/matrix-tag-selector/matrix-tag-selector.component.ts